package com.mind.system.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mind.common.annotation.Excel;
import com.mind.common.enums.RuleEditMode;
import com.mind.common.utils.StringUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * 规则配置(AjRule)
 *
 * @author makejava
 * @since 2024-07-15 15:35:21
 */
@Data
@Schema(description = "规则配置")
public class AjRule implements Serializable {
    /**
     * 主键
     */
    @ExcelIgnore
    private Integer id;
    /**
     * 规则明细id
     */
    @ExcelIgnore
    private Long ruleDetailId;
    /**
     * 规则明细名称
     */
    @Excel(name = "规则明细名称")
    @ExcelProperty("规则明细名称")
    @Schema(description = "规则明细名称")
    private String ruleDetailName;
    /**
     * 业务小类
     */
    @ExcelIgnore
    private String businessCate;

    @Excel(name = "业务小类")
    @ExcelProperty("业务小类")
    @Schema(description = "业务小类")
    private String businessCateName;
    /**
     * 单据类型
     */
    @Excel(name = "单据类型")
    @ExcelProperty("单据类型")
    @Schema(description = "单据类型")
    private String ticketType;


    /**
     * 单据类型
     */
    @Excel(name = "单据类型")
    @ExcelProperty("单据类型")
    @Schema(description = "单据类型")
    private String ticketTypeName;

    /**
     * 业务组别
     */
    @Excel(name = "业务组别")
    @ExcelProperty("业务组别")
    @Schema(description = "业务组别")
    private String businessGroup;
    /**
     * 查验节点
     */
    @Excel(name = "查验节点")
    @ExcelProperty("查验节点")
    @Schema(description = "查验节点")
    private String checkPoint;
    /**
     * 风险等级
     */
    @Excel(name = "风险等级")
    @ExcelProperty("风险等级")
    @Schema(description = "风险等级")
    private Integer riskLevel;
    /**
     * 生效日期
     */
    @Excel(name = "生效日期")
    @ExcelProperty("生效日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "生效日期")
    private Date activeDate;
    /**
     * 失效日期
     */
    @Excel(name = "失效日期")
    @ExcelProperty("失效日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "失效日期")
    private Date expireDate;
    /**
     * 组织ID
     */
    @Excel(name = "组织ID")
    @ExcelProperty("组织ID")
    @Schema(description = "组织ID")
    private String orgIds;
    /**
     * 版本
     */
    @Excel(name = "版本")
    @ExcelProperty("版本")
    @Schema(description = "版本")
    private String version;
    /**
     * 规则配置名称
     */
    @Excel(name = "规则配置名称")
    @ExcelProperty("规则配置名称")
    @Schema(description = "规则配置名称")
    private String name;
    /**
     * 状态
     */
    @Excel(name = "状态")
    @ExcelProperty("状态")
    @Schema(description = "状态:1.生效 2.失效 3.新增 4.复核中(生效) 5.作废 6.失效中 7.新增(生效) 8.复核中 20 保存 21提交 22 失效 23 作废")
    //@ApiModelProperty(value = "状态:1.生效 2.失效 3.新增 4.复核中(生效) 5.作废 6.失效中 7.新增(生效) 8.复核中 20 保存 21提交 22 失效 23 作废")
    private String status;
    @ExcelIgnore
    private AjRuleDetail ruleDetail;
    @ExcelIgnore
    private String isAdd;
    /**
     * 创建时间
     */
    @ExcelIgnore
    private Date createTime;
    @ExcelIgnore
    private String uuid;
    /**
     * 修改时间
     */
    @ExcelIgnore
    private Date updateTime;



    @ExcelIgnore
    private String businessCates;
    @ExcelIgnore
    private List<String> businessCateList;
    @Excel(name = "视图分组")
    @ExcelProperty("视图分组")
    @Schema(description = "视图分组-列表值到数据字典view_group获取")
    private String viewGroup;
    private String ext1;
    private String ext2;
    private String ext3;
    private String ext4;
    private String ext5;
    private String ext6;
    private String ext7;
    private String ext8;
    private String ext9;
    private String ext10;

    private List<String> getBusinessCateList() {
        if(StringUtils.isEmpty(businessCates)){
            return null;
        }else{
            return Arrays.asList(businessCates.split(","));
        }
    }

}

